﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.Exceptions;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using YArchitech.DataModel;
using YArchitech.Revit;

namespace YArchitech.Plumbing
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class LayPumpCommand : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
			Transaction transaction = null;
			Result result;
			try
			{
				if (commandData == null)
				{
					throw new System.ArgumentNullException();
				}
				UIApplication application = commandData.Application;
				UIDocument activeUIDocument = application.ActiveUIDocument;
				Document document = activeUIDocument.Document;
				Selection selection = activeUIDocument.Selection;
				List<ViewType> list = new List<ViewType>();
                list.Add((ViewType)1);
                list.Add((ViewType)2);
                list.Add((ViewType)4);
				if (!YJKRevitTools.ViewCheck(application.ActiveUIDocument, list))
				{
					result = Autodesk.Revit.UI.Result.Cancelled;
				}
				else
				{
					for (;;)
					{
						HYEquipmentCommon hyequipmentCommon = new HYEquipmentCommon();
						ICollection<ElementId> allFamilyInstance = hyequipmentCommon.GetAllFamilyInstance(document, BuiltInCategory.OST_MechanicalEquipment);
						FormLayPump formLayPump = new FormLayPump(document);
						DialogResult dialogResult = formLayPump.ShowDialog();
						HYPumpDataReader hypumpDataReader = new HYPumpDataReader();
						if (dialogResult == DialogResult.OK)
						{
							if (formLayPump.layway == 0)
							{
								FamilySymbol familySymbolByFamilyNameInTran = hypumpDataReader.GetFamilySymbolByFamilyNameInTran(formLayPump.pumpdata.strFamily, "Pump", document, BuiltInCategory.OST_MechanicalEquipment);
								if (familySymbolByFamilyNameInTran != null)
								{
									if (!formLayPump.isLayBase)
									{
										try
										{
											activeUIDocument.PromptForFamilyInstancePlacement(familySymbolByFamilyNameInTran);
										}
										catch (Exception)
										{
										}
										ICollection<ElementId> allFamilyInstance2 = hyequipmentCommon.GetAllFamilyInstance(document, BuiltInCategory.OST_MechanicalEquipment);
										new List<ElementId>();
										foreach (ElementId item in allFamilyInstance.Intersect(allFamilyInstance2))
										{
											allFamilyInstance2.Remove(item);
										}
										transaction = new Transaction(document, "布置水泵");
										transaction.Start();
										foreach (ElementId elementId in allFamilyInstance2)
										{
											Element elementById = document.GetElementById(elementId);
											this.SetParas(elementById, formLayPump.pumpdata, document, formLayPump.offset);
										}
										document.Regenerate();
										transaction.Commit();
									}
									else
									{
										HYPumpBase pumpBaseDataById = HYPumpDataManager.GetPumpBaseDataById(formLayPump.pumpdata.strFitRvtName, "PumpBase");
										string familyName;
										if (formLayPump.isDamp)
										{
											familyName = pumpBaseDataById.dampfamilyname;
										}
										else
										{
											familyName = pumpBaseDataById.familyname;
										}
										FamilySymbol familySymbolByFamilyNameInTran2 = hypumpDataReader.GetFamilySymbolByFamilyNameInTran(familyName, "PumpBase", document, BuiltInCategory.OST_SpecialityEquipment);
										transaction = new Transaction(document, "布置水泵");
										transaction.Start();
										XYZ item2 = selection.PickPoint("选择一个点坐标，在这个点布置水泵和水泵基础");
										List<XYZ> list2 = new List<XYZ>();
										list2.Add(item2);
										ConnectHelper connectHelper = new ConnectHelper();
										ElementSet elementSet = connectHelper.LayFamilyInstance(list2, familySymbolByFamilyNameInTran2, document.ActiveView.GenLevel, 0, document);
										ElementSet elementSet2 = connectHelper.LayFamilyInstance(list2, familySymbolByFamilyNameInTran, document.ActiveView.GenLevel, 0, document);
										document.Regenerate();
										foreach (object obj in elementSet)
										{
											Element elem = (Element)obj;
											this.SetBaseParas(elem, formLayPump.pumpdata, document, formLayPump.offset, formLayPump.isDamp);
										}
										double heightOfBase = this.GetHeightOfBase(formLayPump.isDamp, formLayPump.pumpdata);
										double offset = formLayPump.offset + heightOfBase;
										foreach (object obj2 in elementSet2)
										{
											Element elem2 = (Element)obj2;
											this.SetParas(elem2, formLayPump.pumpdata, document, offset);
										}
										transaction.Commit();
									}
								}
							}
							else
							{
								transaction = new Transaction(document, "布置水泵");
								transaction.Start();
								XYZ xyz = selection.PickPoint("选择第一个点坐标，以这个点为起始点布置水泵");
								XYZ xyz2 = selection.PickPoint("选择第二个点，以确定水泵的走向");
								XYZ xyz3 = selection.PickPoint("选择第三个点，以确定水泵的出口方向");
								while (xyz.IsAlmostEqualTo(xyz2))
								{
									xyz2 = selection.PickPoint("选择第二个点不能与第一个点重复，以确定水泵的走向");
								}
								while (xyz.IsAlmostEqualTo(xyz3))
								{
									xyz3 = selection.PickPoint("选择第三个点不能与第一个点重复，以确定水泵的出口方向");
								}
								XYZ xyz4 = xyz2.Subtract(xyz).Normalize();
								XYZ vector = xyz3.Subtract(xyz).Normalize();
								int num = 1;
								Dictionary<XYZ, FamilySymbol> dictionary = new Dictionary<XYZ, FamilySymbol>();
								Dictionary<XYZ, HYPumpData> dictionary2 = new Dictionary<XYZ, HYPumpData>();
								if (formLayPump.listPumpdataTableForLay.Count > 0)
								{
									num = formLayPump.listPumpdataTableForLay.Count;
								}
								for (int i = 0; i < num; i++)
								{
									XYZ key = new XYZ();
									key = xyz + (double)i * (formLayPump.distance / 304.8) * xyz4;
									string strFamily = formLayPump.listPumpdataTableForLay[i].strFamily;
									FamilySymbol familySymbolByFamilyNameInSub = hypumpDataReader.GetFamilySymbolByFamilyNameInSub(strFamily, "Pump", document, (BuiltInCategory)(-2001140));
									dictionary.Add(key, familySymbolByFamilyNameInSub);
									dictionary2.Add(key, formLayPump.listPumpdataTableForLay[i]);
								}
								if (dictionary != null && dictionary.Count > 0)
								{
									ConnectHelper connectHelper2 = new ConnectHelper();
									ElementSet elementSet3 = connectHelper2.LayFamilyInstance(dictionary, document.ActiveView.GenLevel, 0, document);
									document.Regenerate();
									foreach (object obj3 in elementSet3)
									{
										Element element = (Element)obj3;
										Connector connector = connectHelper2.GetYJKElementConnector(element as FamilyInstance, (Autodesk.Revit.DB.Domain)3).FirstOrDefault((Connector q) => (int)q.Direction == 1);
										if (connector == null)
										{
											break;
										}
										double twoVectorAngle = YJKRevitTools.GetTwoVectorAngle(connector.CoordinateSystem.BasisZ.Normalize(), vector, new XYZ(0.0, 0.0, 1.0));
										XYZ point = (element.Location as LocationPoint).Point;
										XYZ sp = new XYZ(point.X, point.Y, xyz.Z);
										HYPumpData value = dictionary2.FirstOrDefault((KeyValuePair<XYZ, HYPumpData> q) => q.Key.IsAlmostEqualTo(sp, 0.0001)).Value;
										if (value == null)
										{
											return Autodesk.Revit.UI.Result.Failed;
										}
										if (!formLayPump.isLayBase)
										{
											this.SetParas(element, value, document, formLayPump.offset);
										}
										else
										{
											HYPumpBase pumpBaseDataById2 = HYPumpDataManager.GetPumpBaseDataById(value.strFitRvtName, "PumpBase");
											string familyName2;
											if (formLayPump.isDamp)
											{
												familyName2 = pumpBaseDataById2.dampfamilyname;
											}
											else
											{
												familyName2 = pumpBaseDataById2.familyname;
											}
											FamilySymbol familySymbolByFamilyNameInSub2 = hypumpDataReader.GetFamilySymbolByFamilyNameInSub(familyName2, "PumpBase", document, (BuiltInCategory)(-2001350));
                                            IEnumerator enumerator3 = connectHelper2.LayFamilyInstance(new List<XYZ>
											{
												sp
											}, familySymbolByFamilyNameInSub2, document.ActiveView.GenLevel, 0, document).GetEnumerator();
											{
												if (enumerator3.MoveNext())
												{
													Element element2 = (Element)enumerator3.Current;
													this.SetBaseParas(element2, value, document, formLayPump.offset, formLayPump.isDamp);
													Line line = Line.CreateBound(sp, new XYZ(sp.X, sp.Y, 1.0));
													ElementTransformUtils.RotateElement(document, element2.Id, line, twoVectorAngle);
												}
											}
											double heightOfBase2 = this.GetHeightOfBase(formLayPump.isDamp, value);
											double offset2 = formLayPump.offset + heightOfBase2;
											this.SetParas(element, value, document, offset2);
										}
										Line line2 = Line.CreateBound(sp, new XYZ(sp.X, sp.Y, 1.0));
										ElementTransformUtils.RotateElement(document, element.Id, line2, twoVectorAngle);
									}
								}
								transaction.Commit();
							}
						}
						else if (dialogResult == DialogResult.Cancel)
						{
							break;
						}
					}
					result = Autodesk.Revit.UI.Result.Succeeded;
				}
			}
			catch (Autodesk.Revit.Exceptions.OperationCanceledException)
			{
				result = Autodesk.Revit.UI.Result.Succeeded;
			}
			catch (Exception ex)
			{
				message = ex.Message;
				result = Autodesk.Revit.UI.Result.Failed;
			}
			finally
			{
                if (transaction != null && (int)transaction.GetStatus() != 3)
				{
					transaction.RollBack();
				}
			}
			return result;
		}

		public double GetHeightOfBase(bool isDamp, HYPumpData pumpdata)
		{
			double result = 0.0;
			if (isDamp)
			{
				Dictionary<string, string> source = new Dictionary<string, string>();
				source = HYPumpDataManager.ConvertStringToDic(pumpdata.strDampBaseParam);
				if (pumpdata.strFitRvtName == "1" || pumpdata.strFitRvtName == "2")
				{
					string value = source.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "H").Value;
					if (value != null && value != "")
					{
						result = (double.Parse(value) + 20.0) / 1000.0;
					}
				}
				else
				{
					string value2 = source.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "Ha").Value;
					string value3 = source.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "h").Value;
					if (value2 != null && value2 != "" && value3 != null && value3 != "")
					{
						result = (double.Parse(value2) + double.Parse(value3) + 20.0) / 1000.0;
					}
				}
			}
			else
			{
				Dictionary<string, string> source2 = new Dictionary<string, string>();
				source2 = HYPumpDataManager.ConvertStringToDic(pumpdata.strBaseParam);
				if (pumpdata.strFitRvtName == "1" || pumpdata.strFitRvtName == "2")
				{
					string value4 = source2.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "H").Value;
					if (value4 != null && value4 != "")
					{
						result = double.Parse(value4) / 1000.0;
					}
				}
				else
				{
					string value5 = source2.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "Ha").Value;
					string value6 = source2.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "h").Value;
					if (value5 != null && value5 != "" && value6 != null && value6 != "")
					{
						result = (double.Parse(value5) + double.Parse(value6)) / 1000.0;
					}
				}
			}
			return result;
		}

		public void SetParas(Element elem, HYPumpData pumpdata, Document doc, double offset)
		{
			Parameter parameter = elem.GetParameter("生产厂家");
			if (parameter != null)
			{
				parameter.Set(pumpdata.StrFactory);
			}
			Parameter parameter2 = elem.GetParameter("厂家自定类型名");
			if (parameter2 != null)
			{
				parameter2.Set(pumpdata.StrTypeInFactory);
			}
			Parameter parameter3 = elem.GetParameter("水泵型号");
			if (parameter3 != null)
			{
				parameter3.Set(pumpdata.StrSpecification);
			}
			Parameter parameter4 = elem.GetParameter("基本类型");
			if (parameter4 != null)
			{
				parameter4.Set(pumpdata.StrBaseType);
			}
			Parameter parameter5 = elem.GetParameter("结构类型");
			if (parameter5 != null)
			{
				parameter5.Set(pumpdata.StrStructType);
			}
			Parameter parameter6 = elem.GetParameter("安装形式");
			if (parameter6 != null)
			{
				parameter6.Set(pumpdata.StrUse);
			}
			Parameter parameter7 = elem.GetParameter("流量");
			if (parameter7 != null)
			{
				parameter7.Set(UnitConvert.CovertToAPI(pumpdata.DQ, (Autodesk.Revit.DB.DisplayUnitType)66));
			}
			Parameter parameter8 = elem.GetParameter("扬程");
			if (parameter8 != null)
			{
				parameter8.Set(UnitConvert.CovertToAPI(pumpdata.DH, (Autodesk.Revit.DB.DisplayUnitType)0));
			}
			Parameter parameter9 = elem.GetParameter("效率");
			if (parameter9 != null)
			{
				parameter9.Set(UnitConvert.CovertToAPI(pumpdata.DEffection, (Autodesk.Revit.DB.DisplayUnitType)19));
			}
			Parameter parameter10 = elem.GetParameter("转速");
			if (parameter10 != null)
			{
				parameter10.Set(pumpdata.NRotSpeed.ToString() + " r/min");
			}
			Parameter parameter11 = elem.GetParameter("轴功率");
			if (parameter11 != null)
			{
				parameter11.Set(UnitConvert.CovertToAPI(pumpdata.DPumpPower, (Autodesk.Revit.DB.DisplayUnitType)40));
			}
			Parameter parameter12 = elem.GetParameter("电机功率");
			if (parameter12 != null)
			{
				parameter12.Set(UnitConvert.CovertToAPI(pumpdata.DEnginPower, (Autodesk.Revit.DB.DisplayUnitType)40));
			}
			if (pumpdata.dWidth > 0.0)
			{
				elem.GetParameter("宽").Set(pumpdata.dWidth / 304.8);
			}
			if (pumpdata.dHeight > 0.0)
			{
				elem.GetParameter("高").Set(pumpdata.dHeight / 304.8);
			}
			if (pumpdata.dLength > 0.0)
			{
				elem.GetParameter("长").Set(pumpdata.dLength / 304.8);
			}
			if (pumpdata.DIn > 0.0)
			{
				elem.GetParameter("进口管径").Set(pumpdata.DIn / 304.8);
			}
			if (pumpdata.DOut > 0.0)
			{
				elem.GetParameter("出口管径").Set(pumpdata.DOut / 304.8);
			}
			Dictionary<string, string> source = HYPumpDataManager.ConvertStringToDic(pumpdata.strBaseParam);
			if (elem.GetParameter("螺栓孔距") != null)
			{
				string value = source.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "b").Value;
				if (value != "" && value != null)
				{
					elem.GetParameter("螺栓孔距").Set(double.Parse(value) / 304.8);
				}
			}
			if (elem.GetParameter("螺栓孔长距") != null)
			{
				string text = "";
				if (pumpdata.strFitRvtName == "1")
				{
					text = source.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "L1").Value;
				}
				else if (pumpdata.strFitRvtName == "2")
				{
					text = source.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "L3").Value;
				}
				if (text != "" && text != null)
				{
					elem.GetParameter("螺栓孔长距").Set(double.Parse(text) / 304.8);
				}
			}
			if (elem.GetParameter("螺栓孔宽距") != null)
			{
				string text2 = "";
				if (pumpdata.strFitRvtName == "1")
				{
					text2 = source.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "B1").Value;
				}
				else if (pumpdata.strFitRvtName == "2")
				{
					text2 = source.FirstOrDefault((KeyValuePair<string, string> q) => q.Key == "B2").Value;
				}
				if (text2 != "" && text2 != null)
				{
					elem.GetParameter("螺栓孔宽距").Set(double.Parse(text2) / 304.8);
				}
			}
			SetParaForInstance.SetOffsetForInstance(elem, offset, doc);
		}

		public void SetBaseParas(Element elem, HYPumpData pumpdata, Document doc, double offset, bool isDamp)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			if (isDamp)
			{
				dictionary = this.GetDampBaseParaFromDBInChinese(pumpdata);
			}
			else
			{
				dictionary = this.GetBaseParaFromDBInChinese(pumpdata);
			}
			if (dictionary.Count > 0)
			{
				this.SetFamilyPara(dictionary, elem);
			}
			SetParaForInstance.SetOffsetForInstance(elem, offset, doc);
		}

		public void SetFamilyPara(Dictionary<string, string> dicBase, Element ele)
		{
			foreach (KeyValuePair<string, string> keyValuePair in dicBase)
			{
				Parameter parameter = ele.GetParameter(keyValuePair.Key);
				string value = keyValuePair.Value;
				if (parameter != null && value != "" && value != null)
				{
					if (keyValuePair.Key == "减震垫规格")
					{
						parameter.Set(value);
					}
					else
					{
						parameter.Set(double.Parse(value) / 304.8);
					}
				}
			}
		}

		public Dictionary<string, string> GetBaseParaFromDBInChinese(HYPumpData pumpdata)
		{
			Dictionary<string, string> dictionary = HYPumpDataManager.ConvertStringToDic(pumpdata.strBaseParam);
			Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
			if (pumpdata.strFitRvtName == "1")
			{
				using (Dictionary<string, string>.Enumerator enumerator = dictionary.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, string> keyValuePair = enumerator.Current;
						string key = keyValuePair.Key;
						uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(key);
						if (num <= 1530585635u)
						{
							if (num <= 383896283u)
							{
								if (num != 199048284u)
								{
									if (num == 383896283u)
									{
										if (key == "L2")
										{
											dictionary2.Add("螺栓孔边距", keyValuePair.Value);
										}
									}
								}
								else if (key == "B1")
								{
									dictionary2.Add("螺栓孔宽距", keyValuePair.Value);
								}
							}
							else if (num != 400673902u)
							{
								if (num != 1463475159u)
								{
									if (num == 1530585635u)
									{
										if (key == "hf")
										{
											dictionary2.Add("地上混凝土高度", keyValuePair.Value);
										}
									}
								}
								else if (key == "hz")
								{
									dictionary2.Add("找平层厚度", keyValuePair.Value);
								}
							}
							else if (key == "L1")
							{
								dictionary2.Add("螺栓孔长距", keyValuePair.Value);
							}
						}
						else if (num <= 3059570457u)
						{
							if (num != 2414576562u)
							{
								if (num == 3059570457u)
								{
									if (key == "LSK")
									{
										dictionary2.Add("螺栓孔边长", keyValuePair.Value);
									}
								}
							}
							else if (key == "H1")
							{
								dictionary2.Add("螺栓孔深", keyValuePair.Value);
							}
						}
						else if (num != 3339451269u)
						{
							if (num != 3373006507u)
							{
								if (num == 3440116983u)
								{
									if (key == "H")
									{
										dictionary2.Add("基础高度", keyValuePair.Value);
									}
								}
							}
							else if (key == "L")
							{
								dictionary2.Add("基础长度", keyValuePair.Value);
							}
						}
						else if (key == "B")
						{
							dictionary2.Add("基础宽度", keyValuePair.Value);
						}
					}
					return dictionary2;
				}
			}
			if (pumpdata.strFitRvtName == "2")
			{
				using (Dictionary<string, string>.Enumerator enumerator = dictionary.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, string> keyValuePair2 = enumerator.Current;
						string key = keyValuePair2.Key;
						uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(key);
						if (num <= 1463475159u)
						{
							if (num <= 367118664u)
							{
								if (num != 199048284u)
								{
									if (num != 249381141u)
									{
										if (num == 367118664u)
										{
											if (key == "L3")
											{
												dictionary2.Add("螺栓孔长距", keyValuePair2.Value);
											}
										}
									}
									else if (key == "B2")
									{
										dictionary2.Add("螺栓孔宽距", keyValuePair2.Value);
									}
								}
								else if (key == "B1")
								{
									dictionary2.Add("电机基础宽度", keyValuePair2.Value);
								}
							}
							else if (num != 383896283u)
							{
								if (num != 484561997u)
								{
									if (num == 1463475159u)
									{
										if (key == "hz")
										{
											dictionary2.Add("找平层厚度", keyValuePair2.Value);
										}
									}
								}
								else if (key == "L4")
								{
									dictionary2.Add("螺栓孔长距2", keyValuePair2.Value);
								}
							}
							else if (key == "L2")
							{
								dictionary2.Add("螺栓孔边距", keyValuePair2.Value);
							}
						}
						else if (num <= 3059570457u)
						{
							if (num != 1530585635u)
							{
								if (num != 2414576562u)
								{
									if (num == 3059570457u)
									{
										if (key == "LSK")
										{
											dictionary2.Add("螺栓孔边长", keyValuePair2.Value);
										}
									}
								}
								else if (key == "H1")
								{
									dictionary2.Add("螺栓孔深", keyValuePair2.Value);
								}
							}
							else if (key == "hf")
							{
								dictionary2.Add("地面以上高度", keyValuePair2.Value);
							}
						}
						else if (num <= 3373006507u)
						{
							if (num != 3339451269u)
							{
								if (num == 3373006507u)
								{
									if (key == "L")
									{
										dictionary2.Add("基础长度", keyValuePair2.Value);
									}
								}
							}
							else if (key == "B")
							{
								dictionary2.Add("基础宽度", keyValuePair2.Value);
							}
						}
						else if (num != 3440116983u)
						{
							if (num == 3775669363u)
							{
								if (key == "d")
								{
									dictionary2.Add("螺栓直径", keyValuePair2.Value);
								}
							}
						}
						else if (key == "H")
						{
							dictionary2.Add("基础高度", keyValuePair2.Value);
						}
					}
					return dictionary2;
				}
			}
			if (pumpdata.strFitRvtName == "3")
			{
				using (Dictionary<string, string>.Enumerator enumerator = dictionary.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, string> keyValuePair3 = enumerator.Current;
						string key = keyValuePair3.Key;
						uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(key);
						if (num <= 3059570457u)
						{
							if (num <= 2402036085u)
							{
								if (num != 1609250850u)
								{
									if (num == 2402036085u)
									{
										if (key == "b2")
										{
											dictionary2.Add("基础宽度", keyValuePair3.Value);
										}
									}
								}
								else if (key == "Ha")
								{
									dictionary2.Add("基础高度", keyValuePair3.Value);
								}
							}
							else if (num != 2403021823u)
							{
								if (num == 3059570457u)
								{
									if (key == "LSK")
									{
										dictionary2.Add("螺栓孔边长", keyValuePair3.Value);
									}
								}
							}
							else if (key == "h2")
							{
								dictionary2.Add("螺栓孔深", keyValuePair3.Value);
							}
						}
						else if (num <= 3775669363u)
						{
							if (num != 3339451269u)
							{
								if (num == 3775669363u)
								{
									if (key == "d")
									{
										dictionary2.Add("螺栓直径", keyValuePair3.Value);
									}
								}
							}
							else if (key == "B")
							{
								dictionary2.Add("底座宽度", keyValuePair3.Value);
							}
						}
						else if (num != 3876335077u)
						{
							if (num == 3977000791u)
							{
								if (key == "h")
								{
									dictionary2.Add("底座板厚度", keyValuePair3.Value);
								}
							}
						}
						else if (key == "b")
						{
							dictionary2.Add("螺栓孔距", keyValuePair3.Value);
						}
					}
					return dictionary2;
				}
			}
			if (pumpdata.strFitRvtName == "4")
			{
				foreach (KeyValuePair<string, string> keyValuePair4 in dictionary)
				{
					string key = keyValuePair4.Key;
					uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(key);
					if (num <= 3059570457u)
					{
						if (num <= 2402036085u)
						{
							if (num != 1609250850u)
							{
								if (num == 2402036085u)
								{
									if (key == "b2")
									{
										dictionary2.Add("基础宽度", keyValuePair4.Value);
									}
								}
							}
							else if (key == "Ha")
							{
								dictionary2.Add("基础高度", keyValuePair4.Value);
							}
						}
						else if (num != 2403021823u)
						{
							if (num == 3059570457u)
							{
								if (key == "LSK")
								{
									dictionary2.Add("螺栓孔边长", keyValuePair4.Value);
								}
							}
						}
						else if (key == "h2")
						{
							dictionary2.Add("螺栓孔深", keyValuePair4.Value);
						}
					}
					else if (num <= 3775669363u)
					{
						if (num != 3339451269u)
						{
							if (num == 3775669363u)
							{
								if (key == "d")
								{
									dictionary2.Add("螺栓直径", keyValuePair4.Value);
								}
							}
						}
						else if (key == "B")
						{
							dictionary2.Add("底座直径", keyValuePair4.Value);
						}
					}
					else if (num != 3876335077u)
					{
						if (num == 3977000791u)
						{
							if (key == "h")
							{
								dictionary2.Add("底座板厚度", keyValuePair4.Value);
							}
						}
					}
					else if (key == "b")
					{
						dictionary2.Add("螺栓孔距", keyValuePair4.Value);
					}
				}
			}
			return dictionary2;
		}

		public Dictionary<string, string> GetDampBaseParaFromDBInChinese(HYPumpData pumpdata)
		{
			Dictionary<string, string> dictionary = HYPumpDataManager.ConvertStringToDic(pumpdata.strDampBaseParam);
			Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
			if (pumpdata.strFitRvtName == "1")
			{
				using (Dictionary<string, string>.Enumerator enumerator = dictionary.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, string> keyValuePair = enumerator.Current;
						string key = keyValuePair.Key;
						uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(key);
						if (num <= 1040194900u)
						{
							if (num <= 383896283u)
							{
								if (num != 199048284u)
								{
									if (num == 383896283u)
									{
										if (key == "L2")
										{
											dictionary2.Add("螺栓孔边距", keyValuePair.Value);
										}
									}
								}
								else if (key == "B1")
								{
									dictionary2.Add("螺栓孔宽距", keyValuePair.Value);
								}
							}
							else if (num != 400673902u)
							{
								if (num == 1040194900u)
								{
									if (key == "PS")
									{
										dictionary2.Add("减震垫规格", keyValuePair.Value);
									}
								}
							}
							else if (key == "L1")
							{
								dictionary2.Add("螺栓孔长距", keyValuePair.Value);
							}
						}
						else if (num <= 3339451269u)
						{
							if (num != 1530585635u)
							{
								if (num == 3339451269u)
								{
									if (key == "B")
									{
										dictionary2.Add("基础宽度", keyValuePair.Value);
									}
								}
							}
							else if (key == "hf")
							{
								dictionary2.Add("混凝土基础高度", keyValuePair.Value);
							}
						}
						else if (num != 3373006507u)
						{
							if (num != 3440116983u)
							{
								if (num == 3775669363u)
								{
									if (key == "d")
									{
										dictionary2.Add("螺栓直径", keyValuePair.Value);
									}
								}
							}
							else if (key == "H")
							{
								dictionary2.Add("基座高度", keyValuePair.Value);
							}
						}
						else if (key == "L")
						{
							dictionary2.Add("基础长度", keyValuePair.Value);
						}
					}
					return dictionary2;
				}
			}
			if (pumpdata.strFitRvtName == "2")
			{
				using (Dictionary<string, string>.Enumerator enumerator = dictionary.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, string> keyValuePair2 = enumerator.Current;
						string key = keyValuePair2.Key;
						uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(key);
						if (num <= 484561997u)
						{
							if (num <= 249381141u)
							{
								if (num != 199048284u)
								{
									if (num == 249381141u)
									{
										if (key == "B2")
										{
											dictionary2.Add("水泵螺栓孔宽距", keyValuePair2.Value);
										}
									}
								}
								else if (key == "B1")
								{
									dictionary2.Add("电机螺栓孔距", keyValuePair2.Value);
								}
							}
							else if (num != 367118664u)
							{
								if (num != 383896283u)
								{
									if (num == 484561997u)
									{
										if (key == "L4")
										{
											dictionary2.Add("螺栓孔长距2", keyValuePair2.Value);
										}
									}
								}
								else if (key == "L2")
								{
									dictionary2.Add("螺栓孔边距", keyValuePair2.Value);
								}
							}
							else if (key == "L3")
							{
								dictionary2.Add("螺栓孔长距1", keyValuePair2.Value);
							}
						}
						else if (num <= 3339451269u)
						{
							if (num != 1040194900u)
							{
								if (num != 1530585635u)
								{
									if (num == 3339451269u)
									{
										if (key == "B")
										{
											dictionary2.Add("基础宽度", keyValuePair2.Value);
										}
									}
								}
								else if (key == "hf")
								{
									dictionary2.Add("混凝土基础高度", keyValuePair2.Value);
								}
							}
							else if (key == "PS")
							{
								dictionary2.Add("减震垫规格", keyValuePair2.Value);
							}
						}
						else if (num != 3373006507u)
						{
							if (num != 3440116983u)
							{
								if (num == 3775669363u)
								{
									if (key == "d")
									{
										dictionary2.Add("螺栓直径", keyValuePair2.Value);
									}
								}
							}
							else if (key == "H")
							{
								dictionary2.Add("基座高度", keyValuePair2.Value);
							}
						}
						else if (key == "L")
						{
							dictionary2.Add("基础长度", keyValuePair2.Value);
						}
					}
					return dictionary2;
				}
			}
			if (pumpdata.strFitRvtName == "3")
			{
				using (Dictionary<string, string>.Enumerator enumerator = dictionary.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, string> keyValuePair3 = enumerator.Current;
						string key = keyValuePair3.Key;
						uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(key);
						if (num <= 3059570457u)
						{
							if (num <= 1609250850u)
							{
								if (num != 1040194900u)
								{
									if (num == 1609250850u)
									{
										if (key == "Ha")
										{
											dictionary2.Add("基础高度", keyValuePair3.Value);
										}
									}
								}
								else if (key == "PS")
								{
									dictionary2.Add("减震垫规格", keyValuePair3.Value);
								}
							}
							else if (num != 2403021823u)
							{
								if (num == 3059570457u)
								{
									if (key == "LSK")
									{
										dictionary2.Add("螺栓孔边长", keyValuePair3.Value);
									}
								}
							}
							else if (key == "h2")
							{
								dictionary2.Add("螺栓孔深", keyValuePair3.Value);
							}
						}
						else if (num <= 3775669363u)
						{
							if (num != 3339451269u)
							{
								if (num == 3775669363u)
								{
									if (key == "d")
									{
										dictionary2.Add("螺栓直径", keyValuePair3.Value);
									}
								}
							}
							else if (key == "B")
							{
								dictionary2.Add("基础宽度", keyValuePair3.Value);
							}
						}
						else if (num != 3876335077u)
						{
							if (num == 3977000791u)
							{
								if (key == "h")
								{
									dictionary2.Add("底座板厚度", keyValuePair3.Value);
								}
							}
						}
						else if (key == "b")
						{
							dictionary2.Add("螺栓孔距", keyValuePair3.Value);
						}
					}
					return dictionary2;
				}
			}
			if (pumpdata.strFitRvtName == "4")
			{
				foreach (KeyValuePair<string, string> keyValuePair4 in dictionary)
				{
					string key = keyValuePair4.Key;
					uint num = YArchitech.Revit.PrivateImplementationDetails.ComputeStringHash(key);
					if (num <= 2403021823u)
					{
						if (num <= 1609250850u)
						{
							if (num != 1040194900u)
							{
								if (num == 1609250850u)
								{
									if (key == "Ha")
									{
										dictionary2.Add("基础高度", keyValuePair4.Value);
									}
								}
							}
							else if (key == "PS")
							{
								dictionary2.Add("减震垫规格", keyValuePair4.Value);
							}
						}
						else if (num != 2402036085u)
						{
							if (num == 2403021823u)
							{
								if (key == "h2")
								{
									dictionary2.Add("螺栓孔深", keyValuePair4.Value);
								}
							}
						}
						else if (key == "b2")
						{
							dictionary2.Add("基础宽度", keyValuePair4.Value);
						}
					}
					else if (num <= 3339451269u)
					{
						if (num != 3059570457u)
						{
							if (num == 3339451269u)
							{
								if (key == "B")
								{
									dictionary2.Add("底座直径", keyValuePair4.Value);
								}
							}
						}
						else if (key == "LSK")
						{
							dictionary2.Add("螺栓孔边长", keyValuePair4.Value);
						}
					}
					else if (num != 3775669363u)
					{
						if (num != 3876335077u)
						{
							if (num == 3977000791u)
							{
								if (key == "h")
								{
									dictionary2.Add("底座板厚度", keyValuePair4.Value);
								}
							}
						}
						else if (key == "b")
						{
							dictionary2.Add("螺栓孔距", keyValuePair4.Value);
						}
					}
					else if (key == "d")
					{
						dictionary2.Add("螺栓直径", keyValuePair4.Value);
					}
				}
			}
			return dictionary2;
		}
	}
}
